<template>
  <view>

    <view v-if="orderDetail.delivery">
      <up-cell-group v-if="orderDetail.delivery.delivery.value == 1">
        <up-cell title="售后状态">
          <template #value>
            <view class="u-warning">
              {{ orderDetail.status.text }}
            </view>
          </template>
        </up-cell>
        <!-- <up-cell title="物流单号" :value="orderDetail.expressNo">
          <template #value>
            <view class="u-primary">
              {{ orderDetail.expressNo }}
              <uni-icons
                class="u-m-l-10"
                custom-prefix="iconfont"
                type="icon-copy"
                size="18"
                :color="$u.color.warning"
                @click="copyText(orderDetail.expressNo)"
              ></uni-icons>
            </view>
          </template>
        </up-cell> -->
        <up-cell title="收货仓库" :value="`${orderDetail.delivery.store.name}`"></up-cell>
        <up-cell title="仓库地址" :value="orderDetail.delivery.store.address"></up-cell>
        <up-cell title="联系方式" :value="orderDetail.delivery.phone"></up-cell>
        <up-cell title="售后方式" :value="orderDetail.type.text"></up-cell>
        <up-cell title="售后原因" :value="orderDetail.reason"></up-cell>
      </up-cell-group>

      <view class="u-border-top">
        <view
          class="u-p-l-20 u-p-r-20 u-p-b-30 u-p-t-30 u-border-bottom"
          v-for="(item, index) in orderDetail.goods" :key="index"
        >
          <goods-item
            type="horizontal"
            :data="item"
            size="84px"
          ></goods-item>
        </view>
      </view>
    </view>

    <up-cell-group v-if="orderDetail.delivery">
      <up-cell title="支付方式" :value="orderDetail.payType.text"></up-cell>
      <up-cell title="支付金额">
        <template #value>
          <view class="u-warning">
            ￥{{ orderDetail.cash }}
          </view>
        </template>
      </up-cell>
      <up-cell title="余额抵扣" v-if="orderDetail.coin">
        <template #value>
          <view class="u-warning">
            ￥{{ orderDetail.coin }}
          </view>
        </template>
      </up-cell>
    </up-cell-group>

    <view style="height: 80px;"></view>

<!--    <view-->
<!--      class="flex-block p-10"-->
<!--      style="position: fixed; bottom: 0; left: 0; z-index: 999; background-color: #ffffff; width: 100%; box-sizing: border-box;"-->
<!--    >-->
<!--      <up-button size="normal" type="info" @click="finishOrder">取消申诉</up-button>-->
<!--    </view>-->
  </view>
</template>

<script>
export default {
  data() {
    return {
      tradeId: '',
      orderDetail: {}
    }
  },
  onLoad(options) {
    this.tradeId = options.id || ''
    this.getOrderDetail()
  },
  methods: {
    async getOrderDetail() {
      this.$api.order.appealDetail({
        tradeId: this.tradeId
      }).then(res => {
        this.orderDetail = res.data
      })
    },
    copyText(str) {
      uni.setClipboardData({
        data: str,
        success: function () {
          uni.showToast({
            title: '复制成功',
            icon: 'success'
          })
        }
      });
    },
    finishOrder() {

    }
  }
}
</script>

<style lang="stylus" scoped>
</style>